Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 6: Rotating Shapes

../ch06/06fig12.gif
Figure 6.12

The first and second arms of the desk lamp, each rotated using a center of rotation at the lower end of each arm

06fig12.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group{
    children [
    # Lamp base
        Shape {
            appearance DEF White Appearance {
                material Material { }
            }
            geometry Cylinder {
                radius 0.1
                height 0.01
            }
        },
    # Base joint
        Transform {
            translation 0.0 0.15 0.0
            rotation    1.0 0.0 0.0  -0.7
            center      0.0 -0.15 0.0
            children [
            # Lower arm
                DEF LampArm Shape {
                    appearance USE White
                    geometry Cylinder {
                        radius 0.01
                        height 0.3
                    }
                },
            # Lower arm - second arm joint
                Transform {
                    translation 0.0 0.3 0.0
                    rotation    1.0 0.0 0.0  1.9
                    center      0.0 -0.15 0.0
                    children [
                    # Second arm
                        USE LampArm
                    ]
                }
            ]
        }
    ]
}